home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Java / SlideShow / Source Clippings / ImageButton / ImageButton Action Management / ImageButton Action Management.rsrc / TEXT_256.txt < prev   
Encoding:
Text File  |  2000-09-28  |  1.2 KB  |  47 lines

  1.     /**
  2.      * Sets the command name of the action event fired by this button.
  3.      * @param command The name of the action event command fired by this button
  4.      */
  5.     public void setActionCommand(String command)
  6.     {
  7.         actionCommand = command;
  8.     }
  9.  
  10.     /**
  11.      * Returns the command name of the action event fired by this button.
  12.      * @return the action command name
  13.      */
  14.     public String getActionCommand()
  15.     {
  16.         return actionCommand;
  17.     }
  18.  
  19.     /**
  20.      * Adds the specified action listener to receive action events
  21.      * from this button.
  22.      * @param l the action listener
  23.      */
  24.     public void addActionListener(ActionListener l)
  25.     {
  26.         actionListener = AWTEventMulticaster.add(actionListener, l);
  27.     }
  28.  
  29.     /**
  30.      * Removes the specified action listener so it no longer receives
  31.      * action events from this button.
  32.      * @param l the action listener
  33.      */
  34.     public void removeActionListener(ActionListener l)
  35.     {
  36.         actionListener = AWTEventMulticaster.remove(actionListener, l);
  37.     }
  38.     
  39.     /**
  40.      * Fire an action event to the listeners.
  41.      */
  42.     protected void fireActionEvent()
  43.     {
  44.         if (actionListener != null)
  45.             actionListener.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, actionCommand));
  46.     }
  47.